from django.contrib import admin

# Neede from NoPBX
from nopbx.account.models import Person, Department


###############################################################################

class PersonAdmin(admin.ModelAdmin):
    """
    Administrative interface for managing a Person
    """
    list_display = ('last_name', 'first_name', 'email', 'location')
    list_display_links = ('last_name', 'first_name' )
    list_filter = ('location',)

    fieldsets = [
        (None, {'fields': ['first_name', 'last_name', 'email', 'location', 'extension']}),
        ('Long Distance Code', {'fields': ['ld_code', 'ld_access']}),
        ('Sip Account', {'fields': ['sip_enabled', 'sip_username', 'sip_password'], 'classes': ['collapse']}),
    ]
admin.site.register(Person, PersonAdmin)



###############################################################################

class DepartmentAdmin(admin.ModelAdmin):
    """
    """
    list_display = ('name', 'email')
    filter_horizontal = ('people',)

    fieldsets = [
        (None, {'fields': ['name', 'email', 'location', 'extension', 'description']}),
        ('Department Personnel', {'fields': ['people']}),
    ]

admin.site.register(Department, DepartmentAdmin)

